<?php

namespace App\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
    const SUCCESS_CODE = 0;              //成功code
    const FAIL_CODE = 1;              //失败code
    const RE_CODE = 2;              //需要重新登录

    const STATUS_NORMAL = 200;                  //正常
    const STATUS_BAD_REQUEST = 400;              //请求失败
    const STATUS_UNAUTHORIZED = 401;             //没有权限

    /**
     * A list of the exception types that are not reported.
     *
     * @var array
     */
    protected $dontReport = [
        //
        \Tymon\JWTAuth\Exceptions\TokenExpiredException::class,
        \Tymon\JWTAuth\Exceptions\TokenInvalidException::class,
    ];

    /**
     * A list of the inputs that are never flashed for validation exceptions.
     *
     * @var array
     */
    protected $dontFlash = [
        'current_password',
        'password',
        'password_confirmation',
    ];

    /**
     * Register the exception handling callbacks for the application.
     *
     * @return void
     */
    public function register()
    {
        $this->reportable(function (Throwable $e) {
            //
        });
    }

    public function render($request,  $e)
    {
        return parent::render($request, $e);
    }
}
